<%-- Created by IntelliJ IDEA. --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>人事管理系统</title>
    <style>
        table {
            width: 60%;
            margin: 0 auto;
        }

        a {
            text-decoration: none;
        }

        .add {
            padding: 5px 10px;
            border: 1px solid #bfbfbf;
            background-color: lightgray;
        }
    </style>
</head>
<table border="1" align="center">
    <tr>
        <td colspan="7">人员列表</td>
    </tr>
    <tr>
        <td>编号</td>
        <td>姓名</td>
        <td>性别</td>
        <td>年龄</td>
        <td>等级</td>
        <td>部门</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${lists}" var="info">
        <tr>
            <td>${info.id}</td>
            <td>${info.name}</td>
            <td>${info.sex}</td>
            <td>${info.age}</td>
            <td>${info.rank}</td>
            <td>${info.department}</td>
                <%--<td><a href="/delete?id=${info.id}">删除</a></td>--%>
            <td><a href="javascript:void(0);" onclick="del(${info.id});">删除</a></td>
        </tr>
    </c:forEach>
</table>
<br>
<div align="center">
    <a class="add" href="add.jsp">添加人员</a></div>

<script src="static/js/jquery-1.8.3.min.js"></script>
<script>
    $(function () {
        $("tr:even").css("background-color", "#46ecd9");
        $("tr:odd").css("background-color", "#24ff69");

    });

    function del(id) {
        if (confirm("确认删除吗？")) {
            location.href='/delete?id='+id;
        }
    }
</script>
</body>
</html>